home *** CD-ROM | disk | FTP | other *** search
/ PD ROM 1 / PD ROM Volume I - Macintosh Software from BMUG (1988).iso / Stacks / Hyper Business / Check Stuff / CheckWriter / Check Writer / background_2720.txt < prev    next >
Encoding:
Text File  |  1988-04-19  |  8.8 KB  |  392 lines

  1. -- background: 2720 from stack: in
  2. -- bmap block id: 2129
  3. -- flags: 4000
  4. -- background id: 0
  5. -- name: Check
  6. ----- HyperTalk script -----
  7. on newCard
  8.   putDate
  9.   tabKey
  10.   tabKey
  11.   tabKey
  12. end newCard
  13.  
  14. on openCard
  15.   if bkgnd field "Print" is empty then put false into bkgnd field "Print"
  16.   put number of this card - the number of first card of this bkgnd + 1 into field "Number"
  17.   setPrintButton
  18.   click at loc of field "Pay to"
  19.   tabKey
  20. end openCard
  21.  
  22. on closeField
  23.   put true into bkgnd field "Print"
  24.   setPrintButton
  25.   get the short name of the target
  26.   if it is not "Date" and it is not "Year" then putDate
  27. end closeField
  28.  
  29. on setPrintButton
  30.   set hilite of bkgnd button "Print" to bkgnd field "Print"
  31. end setPrintButton
  32.  
  33. on putDate
  34.   get item 2 of the abbrev date
  35.   delete first char of it
  36.   put it into field "Date"
  37.   put char 3 to 4 of word 4 of the abbrev date into field "Year"
  38.   put true into bkgnd field "Print"
  39.   setPrintButton
  40. end putDate
  41.  
  42. --  TextAmount -- returns text version of numeric dollars and cents
  43. --  amount.
  44.  
  45. function textAmount amount
  46. put char (number of chars in amount) - 1 to (number of chars in amount) of amount into cents
  47. get trunc(amount)
  48. if it is 0 then get "zero "
  49. else
  50.   put it mod 100 into units
  51.   put it div 100 into hundreds
  52.   get empty
  53.   if hundreds is not zero then
  54.     if hundreds mod 10 is zero then get text100(hundreds div 10) && "thousand "
  55.     else get text100(hundreds) && "hundred "
  56.   end if
  57.   if units is not zero then put text100(units) & space after it
  58. end if
  59. put "and " & cents & "/100*****************************************************************" after it
  60. put toUpper(first char of it) into first char of it
  61. return it
  62. end textAmount
  63.  
  64. -- text100 -- Utility function for textAmount.
  65.  
  66. function text100 n
  67. put "one two three four five six seven eight nine ten" && "eleven twelve thirteen fourteen fifteen sixteen seventeen" && "eighteen nineteen" into digits
  68. -- handle number less than 20
  69. if n < 20 then
  70.   if n = 0 then get "zero"
  71.   else get word n of digits
  72. else
  73.   -- handle larger numbers
  74.   put n mod 10 into units -- separate units and tens
  75.   put n div 10 into tens
  76.   get word tens of "ten twenty thirty forty fifty sixty seventy eighty ninety"
  77.   if units <> 0 then put "-" & word units of digits after it
  78. end if
  79. return it
  80. end text100
  81.  
  82. -- toUpper -- Convert a lower case letter to upper case.
  83.  
  84. function toUpper a
  85. return numToChar(charToNum(a) - 32)
  86. end toUpper
  87.  
  88.  
  89.  
  90.  
  91. -- part 5 (field)
  92. -- low flags: 00
  93. -- high flags: 0000
  94. -- rect: left=281 top=105 right=122 bottom=348
  95. -- title width / last selected line: 0
  96. -- icon id / first selected line: 0 / 0
  97. -- text alignment: 0
  98. -- font id: 2
  99. -- text size: 12
  100. -- style flags: 0
  101. -- line height: 16
  102. -- part name: Date
  103.  
  104.  
  105. -- part 6 (field)
  106. -- low flags: 00
  107. -- high flags: 0000
  108. -- rect: left=360 top=105 right=122 bottom=384
  109. -- title width / last selected line: 0
  110. -- icon id / first selected line: 0 / 0
  111. -- text alignment: 0
  112. -- font id: 2
  113. -- text size: 12
  114. -- style flags: 0
  115. -- line height: 16
  116. -- part name: Year
  117.  
  118.  
  119. -- part 3 (field)
  120. -- low flags: 00
  121. -- high flags: 0000
  122. -- rect: left=86 top=145 right=162 bottom=366
  123. -- title width / last selected line: 0
  124. -- icon id / first selected line: 0 / 0
  125. -- text alignment: 0
  126. -- font id: 2
  127. -- text size: 12
  128. -- style flags: 0
  129. -- line height: 16
  130. -- part name: Pay to
  131. ----- HyperTalk script -----
  132. on closeField
  133.   if last character of background field "Pay to" <> "*" then put "*************************************************************" after background field "Pay to"
  134.   pass closeField
  135. end closeField
  136.  
  137.  
  138.  
  139. -- part 2 (field)
  140. -- low flags: 00
  141. -- high flags: 0000
  142. -- rect: left=388 top=145 right=162 bottom=468
  143. -- title width / last selected line: 0
  144. -- icon id / first selected line: 0 / 0
  145. -- text alignment: 65535
  146. -- font id: 4
  147. -- text size: 12
  148. -- style flags: 256
  149. -- line height: 16
  150. -- part name: Amount
  151. ----- HyperTalk script -----
  152. on closeField
  153.   repeat while first char of field "amount" is "*"
  154.     delete first char of field "amount"
  155.   end repeat
  156.   if number of chars in field "amount" < 3 then put ".00" after field "amount"
  157.   else if char (number of chars in field "amount") - 2 of field "amount" <> "." then put ".00" after field "amount"
  158.   put textAmount(field "Amount") into field "Text Amount"
  159.   repeat for 9 - (number of chars in field "amount") times
  160.     put "*" before field "amount"
  161.   end repeat
  162.   pass closeField
  163. end closeField
  164.  
  165.  
  166.  
  167.  
  168. -- part 1 (field)
  169. -- low flags: 01
  170. -- high flags: 0000
  171. -- rect: left=38 top=167 right=184 bottom=441
  172. -- title width / last selected line: 0
  173. -- icon id / first selected line: 0 / 0
  174. -- text alignment: 0
  175. -- font id: 2
  176. -- text size: 12
  177. -- style flags: 0
  178. -- line height: 16
  179. -- part name: Text Amount
  180.  
  181.  
  182. -- part 4 (field)
  183. -- low flags: 00
  184. -- high flags: 0000
  185. -- rect: left=55 top=225 right=242 bottom=224
  186. -- title width / last selected line: 0
  187. -- icon id / first selected line: 0 / 0
  188. -- text alignment: 0
  189. -- font id: 2
  190. -- text size: 12
  191. -- style flags: 0
  192. -- line height: 16
  193. -- part name: For
  194.  
  195.  
  196. -- part 7 (button)
  197. -- low flags: 00
  198. -- high flags: A003
  199. -- rect: left=7 top=301 right=323 bottom=142
  200. -- title width / last selected line: 0
  201. -- icon id / first selected line: 0 / 0
  202. -- text alignment: 1
  203. -- font id: 0
  204. -- text size: 12
  205. -- style flags: 0
  206. -- line height: 16
  207. -- part name: Back to First Card
  208. ----- HyperTalk script -----
  209. on mouseUp
  210.   visual effect barn door close
  211.   go first card
  212. end mouseUp
  213.  
  214.  
  215.  
  216.  
  217. -- part 8 (button)
  218. -- low flags: 00
  219. -- high flags: 2000
  220. -- rect: left=174 top=298 right=327 bottom=211
  221. -- title width / last selected line: 0
  222. -- icon id / first selected line: 9301 / 9301
  223. -- text alignment: 1
  224. -- font id: 0
  225. -- text size: 12
  226. -- style flags: 0
  227. -- line height: 16
  228. -- part name: Prev
  229. ----- HyperTalk script -----
  230. on mouseUp
  231.   visual effect scroll right
  232.   go to previous card of this bkgnd
  233. end mouseUp
  234.  
  235.  
  236. -- part 9 (button)
  237. -- low flags: 00
  238. -- high flags: 2000
  239. -- rect: left=276 top=298 right=327 bottom=312
  240. -- title width / last selected line: 0
  241. -- icon id / first selected line: 27009 / 27009
  242. -- text alignment: 1
  243. -- font id: 0
  244. -- text size: 12
  245. -- style flags: 0
  246. -- line height: 16
  247. -- part name: Next
  248. ----- HyperTalk script -----
  249. on mouseUp
  250.   visual effect scroll left
  251.   go to next card of this bkgnd
  252. end mouseUp
  253.  
  254.  
  255. -- part 11 (button)
  256. -- low flags: 00
  257. -- high flags: 2004
  258. -- rect: left=13 top=33 right=68 bottom=54
  259. -- title width / last selected line: 0
  260. -- icon id / first selected line: 20689 / 20689
  261. -- text alignment: 1
  262. -- font id: 0
  263. -- text size: 12
  264. -- style flags: 0
  265. -- line height: 16
  266. -- part name: Home
  267. ----- HyperTalk script -----
  268. on mouseUp
  269.   visual effect iris close
  270.   go home
  271. end mouseUp
  272.  
  273.  
  274.  
  275. -- part 13 (button)
  276. -- low flags: 00
  277. -- high flags: E005
  278. -- rect: left=420 top=88 right=110 bottom=477
  279. -- title width / last selected line: 0
  280. -- icon id / first selected line: 0 / 0
  281. -- text alignment: 1
  282. -- font id: 0
  283. -- text size: 12
  284. -- style flags: 0
  285. -- line height: 16
  286. -- part name: Print
  287. ----- HyperTalk script -----
  288. on mouseUp
  289.   get the hilite of bkgnd button "Print"
  290.   put it into bkgnd field "Print"
  291.   if it is true then putDate
  292. end mouseUp
  293.  
  294.  
  295.  
  296. -- part 14 (field)
  297. -- low flags: 81
  298. -- high flags: 0000
  299. -- rect: left=426 top=91 right=109 bottom=467
  300. -- title width / last selected line: 0
  301. -- icon id / first selected line: 0 / 0
  302. -- text alignment: 0
  303. -- font id: 3
  304. -- text size: 12
  305. -- style flags: 0
  306. -- line height: 16
  307. -- part name: Print
  308.  
  309.  
  310. -- part 16 (field)
  311. -- low flags: 01
  312. -- high flags: 0000
  313. -- rect: left=38 top=92 right=112 bottom=88
  314. -- title width / last selected line: 0
  315. -- icon id / first selected line: 0 / 0
  316. -- text alignment: 0
  317. -- font id: 3
  318. -- text size: 12
  319. -- style flags: 0
  320. -- line height: 16
  321. -- part name: Number
  322.  
  323.  
  324. -- part 19 (button)
  325. -- low flags: 00
  326. -- high flags: A003
  327. -- rect: left=287 top=48 right=70 bottom=387
  328. -- title width / last selected line: 0
  329. -- icon id / first selected line: 0 / 0
  330. -- text alignment: 1
  331. -- font id: 0
  332. -- text size: 12
  333. -- style flags: 0
  334. -- line height: 16
  335. -- part name: New Check
  336. ----- HyperTalk script -----
  337. on mouseUp
  338.   doMenu "New Card"
  339. end mouseUp
  340.  
  341.  
  342.  
  343. -- part 20 (button)
  344. -- low flags: 00
  345. -- high flags: A003
  346. -- rect: left=124 top=48 right=70 bottom=224
  347. -- title width / last selected line: 0
  348. -- icon id / first selected line: 0 / 0
  349. -- text alignment: 1
  350. -- font id: 0
  351. -- text size: 12
  352. -- style flags: 0
  353. -- line height: 16
  354. -- part name: Delete
  355. ----- HyperTalk script -----
  356. on mouseUp
  357.   doMenu "Delete Card"
  358. end mouseUp
  359.  
  360.  
  361.  
  362. -- part 22 (button)
  363. -- low flags: 00
  364. -- high flags: 8000
  365. -- rect: left=395 top=294 right=342 bottom=490
  366. -- title width / last selected line: 0
  367. -- icon id / first selected line: 27009 / 27009
  368. -- text alignment: 1
  369. -- font id: 0
  370. -- text size: 12
  371. -- style flags: 0
  372. -- line height: 16
  373. -- part name: Next Marked Check
  374. ----- HyperTalk script -----
  375. on mouseUp
  376.   set hilite of the target to true
  377.   set lockScreen to true
  378.   set lockMessages to true
  379.   push card
  380.   go to next card
  381.   set lockMessages to false
  382.   visual effect scroll left
  383.   find word true in field "Print"
  384.   if the result is empty then pop card into it
  385.   else
  386.     beep
  387.     pop card
  388.   end if
  389.   set lockScreen to false
  390.   set hilite of the target to false
  391. end mouseUp
  392.